package com.cskaoyan.mall.controller.admin;

import com.cskaoyan.mall.bean.vo.DashBoardVO;
import com.cskaoyan.mall.bean.vo.ResultVO;
import com.cskaoyan.mall.service.GoodsProductService;
import com.cskaoyan.mall.service.GoodsService;
import com.cskaoyan.mall.service.OrderService;
import com.cskaoyan.mall.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Zsp
 * 2021/1/9
 */
@RequestMapping("admin")
@RestController
public class DashBoardController {

    @Autowired
    GoodsService goodsService;
    @Autowired
    GoodsProductService goodsProductService;
    @Autowired
    OrderService orderService;
    @Autowired
    UserService userService;

    @RequestMapping("dashboard")
    public ResultVO dashboard() {
        return ResultVO.ok(new DashBoardVO(goodsService.getGoodsTotal(), userService.getUserTotal(),
                goodsProductService.getProductTotal(),orderService.getOrderTotal()));

    }
}
